/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package warmachinesystem.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import warmachinesystem.Unit;
import warmachinesystem.WarmachineSystemPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Unit</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link warmachinesystem.impl.UnitImpl#getBaseModelNumber <em>Base Model Number</em>}</li>
 *   <li>{@link warmachinesystem.impl.UnitImpl#getIncrement <em>Increment</em>}</li>
 *   <li>{@link warmachinesystem.impl.UnitImpl#getMaxModelNumber <em>Max Model Number</em>}</li>
 *   <li>{@link warmachinesystem.impl.UnitImpl#getIncrementCost <em>Increment Cost</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class UnitImpl extends BaseUnitImpl implements Unit {
	/**
	 * The default value of the '{@link #getBaseModelNumber() <em>Base Model Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBaseModelNumber()
	 * @generated
	 * @ordered
	 */
	protected static final int BASE_MODEL_NUMBER_EDEFAULT = 0;
	/**
	 * The cached value of the '{@link #getBaseModelNumber() <em>Base Model Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBaseModelNumber()
	 * @generated
	 * @ordered
	 */
	protected int baseModelNumber = BASE_MODEL_NUMBER_EDEFAULT;
	/**
	 * The default value of the '{@link #getIncrement() <em>Increment</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIncrement()
	 * @generated
	 * @ordered
	 */
	protected static final int INCREMENT_EDEFAULT = 0;
	/**
	 * The cached value of the '{@link #getIncrement() <em>Increment</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIncrement()
	 * @generated
	 * @ordered
	 */
	protected int increment = INCREMENT_EDEFAULT;
	/**
	 * The default value of the '{@link #getMaxModelNumber() <em>Max Model Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxModelNumber()
	 * @generated
	 * @ordered
	 */
	protected static final int MAX_MODEL_NUMBER_EDEFAULT = 0;
	/**
	 * The cached value of the '{@link #getMaxModelNumber() <em>Max Model Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxModelNumber()
	 * @generated
	 * @ordered
	 */
	protected int maxModelNumber = MAX_MODEL_NUMBER_EDEFAULT;
	/**
	 * The default value of the '{@link #getIncrementCost() <em>Increment Cost</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIncrementCost()
	 * @generated
	 * @ordered
	 */
	protected static final int INCREMENT_COST_EDEFAULT = 0;
	/**
	 * The cached value of the '{@link #getIncrementCost() <em>Increment Cost</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIncrementCost()
	 * @generated
	 * @ordered
	 */
	protected int incrementCost = INCREMENT_COST_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected UnitImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WarmachineSystemPackage.Literals.UNIT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getBaseModelNumber() {
		return baseModelNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBaseModelNumber(int newBaseModelNumber) {
		int oldBaseModelNumber = baseModelNumber;
		baseModelNumber = newBaseModelNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WarmachineSystemPackage.UNIT__BASE_MODEL_NUMBER, oldBaseModelNumber, baseModelNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getIncrement() {
		return increment;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIncrement(int newIncrement) {
		int oldIncrement = increment;
		increment = newIncrement;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WarmachineSystemPackage.UNIT__INCREMENT, oldIncrement, increment));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getMaxModelNumber() {
		return maxModelNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxModelNumber(int newMaxModelNumber) {
		int oldMaxModelNumber = maxModelNumber;
		maxModelNumber = newMaxModelNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WarmachineSystemPackage.UNIT__MAX_MODEL_NUMBER, oldMaxModelNumber, maxModelNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getIncrementCost() {
		return incrementCost;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIncrementCost(int newIncrementCost) {
		int oldIncrementCost = incrementCost;
		incrementCost = newIncrementCost;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WarmachineSystemPackage.UNIT__INCREMENT_COST, oldIncrementCost, incrementCost));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WarmachineSystemPackage.UNIT__BASE_MODEL_NUMBER:
				return getBaseModelNumber();
			case WarmachineSystemPackage.UNIT__INCREMENT:
				return getIncrement();
			case WarmachineSystemPackage.UNIT__MAX_MODEL_NUMBER:
				return getMaxModelNumber();
			case WarmachineSystemPackage.UNIT__INCREMENT_COST:
				return getIncrementCost();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WarmachineSystemPackage.UNIT__BASE_MODEL_NUMBER:
				setBaseModelNumber((Integer)newValue);
				return;
			case WarmachineSystemPackage.UNIT__INCREMENT:
				setIncrement((Integer)newValue);
				return;
			case WarmachineSystemPackage.UNIT__MAX_MODEL_NUMBER:
				setMaxModelNumber((Integer)newValue);
				return;
			case WarmachineSystemPackage.UNIT__INCREMENT_COST:
				setIncrementCost((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WarmachineSystemPackage.UNIT__BASE_MODEL_NUMBER:
				setBaseModelNumber(BASE_MODEL_NUMBER_EDEFAULT);
				return;
			case WarmachineSystemPackage.UNIT__INCREMENT:
				setIncrement(INCREMENT_EDEFAULT);
				return;
			case WarmachineSystemPackage.UNIT__MAX_MODEL_NUMBER:
				setMaxModelNumber(MAX_MODEL_NUMBER_EDEFAULT);
				return;
			case WarmachineSystemPackage.UNIT__INCREMENT_COST:
				setIncrementCost(INCREMENT_COST_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WarmachineSystemPackage.UNIT__BASE_MODEL_NUMBER:
				return baseModelNumber != BASE_MODEL_NUMBER_EDEFAULT;
			case WarmachineSystemPackage.UNIT__INCREMENT:
				return increment != INCREMENT_EDEFAULT;
			case WarmachineSystemPackage.UNIT__MAX_MODEL_NUMBER:
				return maxModelNumber != MAX_MODEL_NUMBER_EDEFAULT;
			case WarmachineSystemPackage.UNIT__INCREMENT_COST:
				return incrementCost != INCREMENT_COST_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (baseModelNumber: ");
		result.append(baseModelNumber);
		result.append(", increment: ");
		result.append(increment);
		result.append(", maxModelNumber: ");
		result.append(maxModelNumber);
		result.append(", incrementCost: ");
		result.append(incrementCost);
		result.append(')');
		return result.toString();
	}

} //UnitImpl
